package render

const FrameWidth = 256
const FrameHeight = 240

type Frame struct {
	Data []byte
}

func NewFrame() *Frame {
	return &Frame{
		Data: make([]byte, FrameWidth*FrameHeight*3),
	}
}

// SetPixel sets the color of a pixel at the given coordinates.
func (f *Frame) SetPixel(x, y int, r, g, b byte) {
	base := y*3*FrameWidth + x*3
	if base+2 < len(f.Data) {
		f.Data[base] = r
		f.Data[base+1] = g
		f.Data[base+2] = b
	}
}
